package com.ruoyi.fetv.controller;

import com.ruoyi.common.aspect.annotation.AutoDict;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.fetv.controller.vo.statistics.DepartmentStudentCountRespVO;
import com.ruoyi.fetv.service.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @ClassName StatisticsController
 * @Description
 * @Author 肖润杰
 * @Time 2023/4/14 9:32
 * @Version 1.0
 */
@RestController
@RequestMapping("/fetv/statistics")
@Api(value = "/fetv/statistics", tags = {"统计"})
@Validated
@AutoDict
public class StatisticsController extends BaseController {
    @Autowired
    StatisticsService statisticsService;
    /**
     * 统计所有高校里面的人数，排除计算机系
     */
    @GetMapping("departmentStudentCountExcludeComputer")
    @ApiOperation(value = "统计所有高校里面的人数，排除计算机系", notes = "统计所有高校里面的人数，排除计算机系", httpMethod = "GET")
    @ApiResponses({
            @ApiResponse(code = 200, message = "", response = DepartmentStudentCountRespVO.class),
    })
    public AjaxResult departmentStudentCount()
    {
        List<DepartmentStudentCountRespVO> departmentStudentCountRespVOS = statisticsService.schoolDepartmentStudentCountStatisticsExcludeComputerDepartment();
        return success(departmentStudentCountRespVOS);
    }
    /**
     * 统计所有高校里面的人数
     */
    @GetMapping("departmentStudentCountByNames")
    @ApiParam
    @ApiOperation(value = "统计所有高校里面的人数", notes = "统计所有高校里面的人数", httpMethod = "GET")
    @ApiResponses({
            @ApiResponse(code = 200, message = "", response = DepartmentStudentCountRespVO.class),
    })
    @ApiImplicitParam(paramType = "query", dataType = "String[]", name = "query", value = "排除的院系名列表")
    public AjaxResult departmentStudentCountByNames(@RequestParam("query") String[] query)
    {
        List<DepartmentStudentCountRespVO> departmentStudentCountRespVOS = statisticsService.StudentCountExcludeByNames(Arrays.asList(query));
        return success(departmentStudentCountRespVOS);
    }
    /**
     * 统计所有高校里面的人数
     */
    @GetMapping("departmentStudentCountByIds")
    @ApiParam
    @ApiOperation(value = "统计所有高校里面的人数", notes = "统计所有高校里面的人数", httpMethod = "GET")
    @ApiResponses({
            @ApiResponse(code = 200, message = "", response = DepartmentStudentCountRespVO.class),
    })
    @ApiImplicitParam(paramType = "query", dataType = "Long[]", value = "排除的院系ids", name = "query")
    public AjaxResult departmentStudentCountByIds(@RequestParam("query") Long[] query)
    {
        List<DepartmentStudentCountRespVO> departmentStudentCountRespVOS = statisticsService.StudentCountExcludeByIds(Arrays.asList(query));
        return success(departmentStudentCountRespVOS);
    }
}
